<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML>
<html>
	<head>
		<base href="<%=basePath%>">

		<title>系统功能列表</title> 
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>css/bootstrap.css">
		<link rel="stylesheet" type="text/css"
			href="<%=basePath%>css/theme.css">
		<script src="<%=basePath%>jquery/jquery.min.js"
			type="text/javascript"></script>
		<script src="<%=basePath%>layer-v2.4/layer/layer.js"
			type="text/javascript"></script>	
		<script src="/jquery/my.js" type="text/javascript"></script>	
	    <style type="text/css">
	      td.td{
	    	  height:50px;
	          line-height:50px;
	      }
	      td.td1 form{
	        height:0;
	      }
	      td.td1 form input{
	        display: inline-block;
	        padding:0;
	        margin:-10px;
	        border:0;
	        width:60px;
	      }
	      td.td1{
	        display: block;
	        margin:0;
	        padding:5px;
	        height:70px;
	        width:65px;
	      }
		</style>
	</head>

	<body class="content1">
		<div class="header">
			<h1 class="page-title">
				系统功能管理
			</h1>
		</div>
		<ul class="breadcrumb">
			<li>
				<a href="index.jsp">Home</a>
				<span class="divider">/</span>
			</li>
			<li class="active">
				功能列表
			</li>
		</ul>
		<div class="container-fluid">
			<div class="row-fluid">
				<form class="form-inline" method="get"
					action="<%=basePath%>fun/list">
					<input class="input-xlarge" placeholder="功能名称..." name="pname"
						type="text">
					<input class="btn icon-search" type="submit" value="查询" />
					<a class="btn btn-primary" href="<%=basePath%>fun/add">
						<i class="icon-plus"></i> 新建顶层功能
					</a>
				</form>

				<div class="well">
					<table class="table">
						<thead>
							<tr>
								<th>
									父功能
								</th>
								<th>
									功能名称
								</th>
								<th>
									功能地址
								</th>
								<th>
									功能状态
								</th>
								<th style="width: 90px;">
									编辑
								</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${pager.list}" var="item">
								<tr>
									<td class="td">
										${item.fpname}
									</td>
									<td class="td">
										${item.fname}
									</td>
									<td class="td">
										${item.furl}
									</td>
									<td class="td">
										<c:choose>
											<c:when test="${item.fstate==1}">
												正常		
											</c:when>
											<c:otherwise>锁定</c:otherwise>
										</c:choose>
									</td>
									<td class="td1">
									    <form action="<%=basePath%>fun/detail/${item.fid}" >
									        <input type="submit" value="修改" class="btn btn-success">
									    </form>
										 <form class="im_tijiao" action="<%=basePath%>fun/delete/${item.fid}" method="post">
									         <input type="hidden" name="_method" value="DELETE">
									         <input type="button" value="删除" class="dianji btn btn-danger">
									     </form>
									      <form action="<%=basePath%>fun/add" method="get">
									         <input type="hidden" name="fpid" value="${item.fid}">
									          <input type="hidden" name="fpname" value="${item.fname}">
									         <input type="submit" value="子功能" class="btn btn-info">
									     </form>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<div class="pagination pagination-right">
						<ul>
							<li>
								<a>共计：${pager.pagectrl.pagecount}页/${pager.pagectrl.rscount}条记录</a>
							</li>
							
							<li>
								<c:if test="${pager.pagectrl.currentindex==1}" var="fp">
									<a style="disabled:true">上一页</a>
								</c:if>
								<c:if test="${!fp}">
									<a href="<%=basePath%>fun/list?pname=${param.pname}&current=${pager.pagectrl.currentindex-1}">上一页</a>
								</c:if>
							</li>						
							
							<c:forEach begin="${pager.pagectrl.minpage}" step="1" end="${pager.pagectrl.maxpage}" var="index">
							<li>
								<c:if test="${pager.pagectrl.currentindex==index}" var="t">
									<a style="color:red;background-color:#bbb">${index}</a>
								</c:if>
								<c:if test="${!t}">
								<a href="<%=basePath%>fun/list?pname=${param.pname}&current=${index}">${index}</a>
								</c:if>
							</li>
							</c:forEach>
							
							<li>
								<c:if test="${pager.pagectrl.currentindex==pager.pagectrl.pagecount}" var="fp">
									<a style="disabled:true">下一页</a>
								</c:if>
								<c:if test="${!fp}">
									<a href="<%=basePath%>fun/list?pname=${param.pname}&current=${pager.pagectrl.currentindex+1}">下一页</a>
								</c:if>
							</li>
						</ul>
					</div>
					<div style="color: red">
						${msg}
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
